package com.qf.consumer1.consumers;

import com.qf.consumer1.pojo.Order;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
//消费test主题下，tag为sync的消息。对于非sync的消息一律不消费
//@RocketMQMessageListener(topic = "test",consumerGroup = "test-group1",selectorExpression = "orderly")
//保障消息的消费顺序，要改变消费模式
//将consumeMode = ConsumeMode.ORDERLY修改成ORDERLY后，消费者端在多线程环境下会通过加锁的方式保证消息处理的顺序性
@RocketMQMessageListener(topic = "test",consumerGroup = "test-group1",selectorExpression = "trans")
public class Consumer6 implements RocketMQListener<String> {
    @Override
    public void onMessage(String order) {
        System.out.println("consumer6");

        System.out.println("开始执行下游事务，消息内容:" + order);

        System.out.println("-----------------------");
    }
}
